<template>
  <div>
    <component :row-data="selectedRowData"  :is="currentComponent" @createMatter="replaceComponent" @editMatter="hrefEditMatter" @getInto="handleGetInto"></component>
  </div>
</template>

<script>
import { ref } from 'vue';
import TabsWithPositionSelector from '@/components/Tabs/TabsWithPositionSelector';
import TabsMatter from '@/components/Tabs/TabsMatter';
import TabsMatterInfo from '@/components/Tabs/TabsMatterInfo';
import createMatter from '@/components/WorkImplementation/matter/createMatter';
import editMatter from '@/components/WorkImplementation/matter/editMatter';

export default {
  name: 'index',
  components: {
    TabsWithPositionSelector,
    TabsMatter,
    TabsMatterInfo,
    createMatter,
    editMatter
  },
  setup() {
    const currentComponent = ref('TabsWithPositionSelector');
    const selectedRowData = ref(null);
    const taskData = ref(null);

    const replaceComponent = (row) => {
      selectedRowData.value = row;
      // currentComponent.value = 'TabsMatter';
       currentComponent.value = 'createMatter';

    };
    const hrefEditMatter = (row) => {
      selectedRowData.value = row;
      // currentComponent.value = 'TabsMatter';
       currentComponent.value = 'editMatter';

    };

    const handleGetInto = (row) => {
      currentComponent.value = 'TabsMatterInfo';
      selectedRowData.value = row; // 将接收到的 row 数据存储在父组件的数据中
    };

    return {
      currentComponent,
      selectedRowData,
      replaceComponent,
      hrefEditMatter,
      handleGetInto
    };
  }
};
</script>

<style scoped>
/* 样式 */
</style>
